#include "TimerMSSingle.h"

TimerMSSingle::TimerMSSingle()
{
	m_currentTimeMS = 0;
	m_ticksPreviousFrame = (unsigned int)GetTickCount();
	m_dtMS = 0;
}

void TimerMSSingle::UpdateTime()
{
	unsigned int ticksCurrentFrame = (unsigned int)GetTickCount();
	unsigned int diff = ticksCurrentFrame - m_ticksPreviousFrame;

	m_dtMS = (unsigned int)diff;

	m_ticksPreviousFrame = ticksCurrentFrame;

	m_currentTimeMS += m_dtMS;
}

void TimerMSSingle::SetTimeMS(unsigned int ms)
{
	m_currentTimeMS = ms;
}

unsigned int TimerMSSingle::GetTimeMS() const
{
	return m_currentTimeMS;
}

unsigned int TimerMSSingle::GetDtMS() const
{
	return m_dtMS;
}